package Servlet;
import Shiti.Shopti;
import Shiti.Userti;
import service.Userservice;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@WebServlet("/ziqueryuserservlet")
public class ziqueryuserservlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;utf-8");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = response.getWriter();
        int acc= Integer.parseInt(request.getParameter("acc1"));
        String psw = request.getParameter("psw1");
        Userti userti = new Userti();
        Userservice userservice = new Userservice();
        userti=userservice.zicha(acc,psw);
        if (userti!=null){
            out.print("acc"+"\t"+"psw"+"\t"+"name");
            response.getWriter().write("<br>");
            out.println(userti.getAcc()+"\t"+userti.getPsw()+"\t"+userti.getName());
        }else {
            out.println("错误");
        }
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
